package com.firexxx.study.designmodel.dutychain;

/**
 * @description: TODO
 * @throws:
 * @author: zhuangzhang2
 * @date: 2019/11/14 14:53
 */
public abstract class AbstractHandler {

    private AbstractHandler next = null;

    public AbstractHandler getNext() {
        return next;
    }

    public void setNext(AbstractHandler next) {
        this.next = next;
    }

    public abstract boolean deal(String data);

    public void handle(String data) {
        if (!deal(data)) {
            if (next != null) {
                next.handle(data);
            }
        }
    }
}